//
//  QLViewPager.h
//  QLSchool_IOS
//
//  Created by anan on 14-1-14.
//  Copyright (c) 2014年 baobaodev_anan. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "QLPagerFragmentAdapter.h"
#import "QLFragment.h"
#import "QLTabPageIndicator.h"

@class QLPagerFragmentAdapter;
@class QLViewPager;
@class QLTabPageIndicator;


/**
 *  QLViewPager代理
 */
@protocol QLViewPagerDelegate<NSObject>

@optional
/**
 *  页面发生切换
 *
 *  @param viewPager
 *  @param select
 */
- (void)onPageChange:(QLViewPager *)viewPager select:(int)select;

@end;

/**
 *  多页tab布局
 */
@interface QLViewPager : UIView<UIScrollViewDelegate>

/**
 *  指示器
 */
@property (nonatomic,strong) QLTabPageIndicator *tabPageIndicator;

/**
 *  指示器背景
 */
@property (nonatomic,strong) UIImageView *imageViewTabPageIndicator;

/**
 *  横向滚动的父容器
 */
@property (nonatomic,strong) UIScrollView *scrollView;
/**
 *  碎片数据适配器
 */
@property (nonatomic,strong) QLPagerFragmentAdapter *adapter;
/**
 *  当前显示的索引
 */
@property (nonatomic) int currentIndex;
/**
 *  当前显示的碎片
 */
@property (nonatomic,strong) QLFragment *currentFragment;
/**
 *  QLViewpager代理
 */
@property (nonatomic,strong) id<QLViewPagerDelegate> delegate;
/**
 *  是否显示指示器
 */
@property (nonatomic)BOOL showPageIndicator;
/**
 *  指示器高度
 */
@property (nonatomic)int pageIndicatorHeight;
/**
 *  缓存页面个数，默认为3
 */
@property (nonatomic)int limit;

/**
 *  重新根据adapter绘制界面
 */
- (void)reloadData;

/**
 *  切换到某tab
 *
 *  @param currentIndex
 *  @param animated     
 */
- (void)setCurrentIndex:(int)currentIndex animated:(BOOL)animated;

/**
 *  清空所有fragment
 */
- (void)clearAllFragment;

/**
 *  初始化(必须调用)
 */
- (void)setup;

@end